package com.petAdoption.manager.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.petAdoption.manager.entity.Petbreed;
import com.petAdoption.manager.mapper.PetbreedMapper;
import com.petAdoption.manager.service.IPetbreedService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.petAdoption.manager.vo.PetVO;
import com.petAdoption.manager.vo.PetbreedVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 王倩茹
 * @since 2023-08-28
 */
@Service
public class PetbreedServiceImpl extends ServiceImpl<PetbreedMapper, Petbreed> implements IPetbreedService {
    @Resource
    private PetbreedMapper petbreedMapper;


    @Override
    public List<PetbreedVO> findAll() {
        return petbreedMapper.findAll();
    }

    @Override
    public int delPetBreed(Integer petbreedId) {
        QueryWrapper queryWrapper = new QueryWrapper<>().eq("petbreed_id",petbreedId);
        return petbreedMapper.deleteById(petbreedId);
    }

    @Override
    public int addPetBreed(Petbreed petbreed) {
        return petbreedMapper.insert(petbreed);
    }

//    @Override
//    public int updatePetBreed(Petbreed petbreed) {
//        UpdateWrapper updateWrapper = new UpdateWrapper<>();
//        updateWrapper.set("petbreed_name",petbreed.getPetbreedId());
//        updateWrapper.set("pettype_ame",petbreed.getPettypename());
//        int update = petbreedMapper.update(null,updateWrapper);
//        return update;
//    }
}
